<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // lastIndexOf方法和indexOf方法类似，它用于查找元素在数组最后一项的索引，如果不存在则返回-1：
    var arr = [1, 5, 3, 4, 5, 6, 7];
    console.log(arr.indexOf(5)); //1
    console.log(arr.lastIndexOf(5)); //4
</script>

</html>